from __future__ import with_statement
from fabric.api import run, env, settings, sudo
from uc_deploy import uc_utils
import os
def script_upload():
    '''
    # 1 uploads ubuntu installer script to home
    '''
#    script_name = env.conf['UBUNTU_SETUP_SCRIPT']
    script_name = 'setup-web2py-ubuntu.sh'
    script_url = os.path.join('scripts',script_name)
    script_target_url = env.conf['UBUNTU_SETUP_SCRIPT']
    uc_utils.upload('script','setup-web2py-ubuntu.sh',
                                 script_target_url,
                                 use_sudo=False)
    run('chmod +x %s' % env.conf['UBUNTU_SETUP_SCRIPT'])
    print('ssh to host and run script with sudo')

